package business;

import java.util.Date;

import utils.Utils;

public class Local {

	private static final String ATT_PROVINCIA = "provincia";
	private static final String ATT_CLANAE = "clanae";
	private static final String ATT_CUIT = "cuit";
	private static final String ATT_NOMBRE = "nombre";
	private static final String ATT_CALLE = "calle";
	private static final String ATT_NUMERO = "numero";
	private static final String ATT_PISO = "piso";
	private static final String ATT_OFICINA = "oficina";
	private static final String ATT_ZIP = "zip";
	private static final String ATT_MUNICIPIO = "municipio";
	private static final String ATT_DPTO = "dpto";
	private static final String ATT_TELEFONO = "telefono";
	private static final String ATT_FAX = "fax";
	private static final String ATT_MAIL = "mail";
	private static final String ATT_LOCAL_ACTIVIDAD = "local_actividad";
	private static final String ATT_PRODUCTO_PRI = "producto_pri";
	private static final String ATT_MATERIA_PRIMA = "materia_prima";
	private static final String ATT_ACTIVIDAD = "actividad";
	private static final String ATT_INICIO_ACTIVIDAD = "inicio_act";
	
	public static final String VAR_L_1_14_0_1 = "L~1.14.0.1";
	public static final String VAR_LR_1_14_0_1 = "LR~1.14.0.1";
	public static final String VAR_L_EN_ST = "L~Exc.Ne_ST";
	public static final String VAR_L_EN_CT = "L~Exc.Ne_CT";

	private Long id;
	private Long localNumber;
	private Company company;
	private NameType nameType;
	private String localName;
	private String previsionalCuit;
	private LocalType localType;
	private String street;
	private String number;
	private String flat;
	private String office;
	private String zipCode;
	private Province province;
	private State state;
	private City city;
	private Country country;
	private Date localStartDate;
	private Date localEndDate;
	private Date localCreateDate;
	private String observations;
	private String localActivity;
	private Long employees;
	private String activity;
	private Long miningActivity;
	private Long activityCountry;
	private String clanae;
	private String product;
	private String rawMaterial;

	public Local() {
		super();
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getLocalNumber() {
		return localNumber;
	}

	public void setLocalNumber(Long localNumber) {
		this.localNumber = localNumber;
	}

	public Company getCompany() {
		return company;
	}

	public void setCompany(Company company) {
		this.company = company;
	}

	public NameType getNameType() {
		return nameType;
	}

	public void setNameType(NameType nameType) {
		this.nameType = nameType;
	}

	public String getLocalName() {
		return localName;
	}

	public void setLocalName(String localName) {
		this.localName = localName;
	}

	public String getPrevisionalCuit() {
		return previsionalCuit;
	}

	public void setPrevisionalCuit(String previsionalCuit) {
		this.previsionalCuit = previsionalCuit;
	}

	public LocalType getLocalType() {
		return localType;
	}

	public void setLocalType(LocalType localType) {
		this.localType = localType;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getFlat() {
		return flat;
	}

	public void setFlat(String flat) {
		this.flat = flat;
	}

	public String getOffice() {
		return office;
	}

	public void setOffice(String office) {
		this.office = office;
	}

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public Province getProvince() {
		return province;
	}

	public void setProvince(Province province) {
		this.province = province;
	}

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	public City getCity() {
		return city;
	}

	public void setCity(City city) {
		this.city = city;
	}

	public Country getCountry() {
		return country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}

	public Date getLocalStartDate() {
		return localStartDate;
	}

	public void setLocalStartDate(Date localStartDate) {
		this.localStartDate = localStartDate;
	}

	public Date getLocalEndDate() {
		return localEndDate;
	}

	public void setLocalEndDate(Date localEndDate) {
		this.localEndDate = localEndDate;
	}

	public Date getLocalCreateDate() {
		return localCreateDate;
	}

	public void setLocalCreateDate(Date localCreateDate) {
		this.localCreateDate = localCreateDate;
	}

	public String getObservations() {
		return observations;
	}

	public void setObservations(String observations) {
		this.observations = observations;
	}

	public String getLocalActivity() {
		return localActivity;
	}

	public void setLocalActivity(String localActivity) {
		this.localActivity = localActivity;
	}

	public Long getEmployees() {
		return employees;
	}

	public void setEmployees(Long employees) {
		this.employees = employees;
	}

	public String getActivity() {
		return activity;
	}

	public void setActivity(String activity) {
		this.activity = activity;
	}

	public Long getMiningActivity() {
		return miningActivity;
	}

	public void setMiningActivity(Long miningActivity) {
		this.miningActivity = miningActivity;
	}

	public Long getActivityCountry() {
		return activityCountry;
	}

	public void setActivityCountry(Long activityCountry) {
		this.activityCountry = activityCountry;
	}
		
	public String getClanae() {
		return clanae;
	}

	public void setClanae(String clanae) {
		this.clanae = clanae;
	}
	
	public String getProduct() {
		return product;
	}

	public void setProduct(String product) {
		this.product = product;
	}

	public String getRawMaterial() {
		return rawMaterial;
	}

	public void setRawMaterial(String rawMaterial) {
		this.rawMaterial = rawMaterial;
	}

	public String getAttribute(String attName) {
		if (attName.equals(ATT_PROVINCIA)) {
			if(getProvince() != null)
			{
				return getProvince().getProvince();	
			}
		} else if (attName.equals(ATT_CLANAE)) {
			return getClanae();
		} else if (attName.equals(ATT_CUIT)) {			
			if(getCompany() != null)
			{
				return getCompany().getCuit();	
			}
		} else if (attName.equals(ATT_NOMBRE)) {
			return getLocalName();
		} else if (attName.equals(ATT_CALLE)) {
			return getStreet();
		} else if (attName.equals(ATT_NUMERO)) {
			return String.valueOf(getNumber());
		} else if (attName.equals(ATT_PISO)) {
			return getFlat();
		} else if (attName.equals(ATT_OFICINA)) {
			return getOffice();
		} else if (attName.equals(ATT_ZIP)) {
			return getZipCode();
		} else if (attName.equals(ATT_MUNICIPIO)) {
			if(getCity() != null)
			{
				return getCity().getCity();	
			}			
		} else if (attName.equals(ATT_DPTO)) {
			if(getState() != null)
			{
				return getState().getDescription();
			}
		} else if (attName.equals(ATT_TELEFONO)) {
			if(getCompany() != null)
			{
				return getCompany().getTelephoneNumber();
			}
		} else if (attName.equals(ATT_FAX)) {
			if(getCompany() != null)
			{
				return getCompany().getFaxNumber();
			}
		} else if (attName.equals(ATT_MAIL)) {
			if(getCompany() != null)
			{
				return getCompany().getEmail();
			}
		} else if (attName.equals(ATT_LOCAL_ACTIVIDAD)) {
			return getLocalActivity();
		} else if (attName.equals(ATT_PRODUCTO_PRI)) {
			return getProduct();
		} else if (attName.equals(ATT_MATERIA_PRIMA)) {
			return getRawMaterial();
		} else if (attName.equals(ATT_ACTIVIDAD)) {
			return getActivity();
		} else if (attName.equals(ATT_INICIO_ACTIVIDAD)) {
			return Utils.convertDateToString(getLocalStartDate());
		}
		
		return null;
	}
}
